package com.example.teacherservice.repository;

import com.example.teacherservice.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {

    Optional<User> findByUsername(String username);

    Optional<User> findByIdAndDeleted(Long id, Integer deleted);

    boolean existsByUsernameAndDeleted(String username, Integer deleted);

    boolean existsByUsernameAndDeletedAndIdNot(String username, Integer deleted, Long id);

    List<User> findByDeleted(Integer deleted);
}